package com.quiz.bis.controller;

import com.quiz.bis.domain.bo.ScoreAppealBo;
import com.quiz.bis.domain.bo.ScoreQueryBo;
import com.quiz.bis.domain.vo.StudentAppealVo;
import com.quiz.bis.domain.vo.StudentExamScoreDetailVo2;
import com.quiz.bis.domain.vo.StudentScoreVo2;
import com.quiz.bis.service.IScoreStudentService;
import com.quiz.common.core.domain.R;
import com.quiz.common.mybatis.core.page.PageQuery;
import com.quiz.common.mybatis.core.page.TableDataInfo;
import io.swagger.v3.oas.annotations.tags.Tag;
import lombok.RequiredArgsConstructor;
import org.springframework.validation.annotation.Validated;
import org.springframework.web.bind.annotation.*;

import java.util.List;


/**
 * 学生端成绩管理控制器
 *
 * @author ahuan
 */
@RestController
@RequestMapping("/score")
@Tag(name = "学生端成绩管理控制器")
@RequiredArgsConstructor
public class ScoreStudentController {

    private final IScoreStudentService scoreService;

    /**
     * 分页查询学生成绩列表
     */
    @GetMapping("/student/list")
    public TableDataInfo<StudentScoreVo2> listStudentScores(@Validated ScoreQueryBo query, PageQuery pageQuery) {
        return scoreService.pageStudentScoreList(query, pageQuery);
    }

    /**
     * 获取学生成绩详情
     */
    @GetMapping("/student/detail/{recordId}")
    public R<StudentExamScoreDetailVo2> getStudentScoreDetail(@PathVariable Long recordId) {
        return R.ok(scoreService.getStudentScoreDetail(recordId));
    }

    /**
     * 提交成绩申诉
     */
    @PostMapping("/student/appeal")
    public R<Void> submitAppeal(@RequestBody ScoreAppealBo appealBo) {
        return scoreService.submitAppeal(appealBo);
    }

    /**
     * 获取学生申诉记录
     */
    @GetMapping("/student/appeal/list")
    public TableDataInfo<StudentAppealVo> getStudentAppealList(@RequestParam Long groupId, PageQuery pageQuery) {
        return scoreService.getStudentAppealList(groupId, pageQuery);
    }
}
